package com.cz.zslu.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.cz.zslu.entity.ZslStoreCommodity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 商品管理 Mapper 接口
 * </p>
 */
public interface ZslStoreCommodityMapper extends BaseMapper<ZslStoreCommodity> {

    @Override
    @Select("select info.*,store.name as storename,store.province_id,store.city_id,store.district_id,store.qq,store.address ${ew.sqlSelect} " +
            "from zsl_store_commodity as info  LEFT JOIN  zsl_store as store on info.store_id=store.id where 1=1 ${ew" +
            ".sqlSegment}")
    List<ZslStoreCommodity> selectPage(RowBounds rowBounds, @Param("ew") Wrapper<ZslStoreCommodity> wrapper);


    /**
     * <p>
     * 根据 ID 查询
     * </p>
     *
     * @param id 主键ID
     * @return T
     */
    @Override
    @Select("select info.*,store.name as storename,store.province_id,store.city_id,store.district_id,store.qq  " +
            "from zsl_store_commodity as info  LEFT JOIN  zsl_store as store on info.store_id=store.id where info.id=#{id} ")
    ZslStoreCommodity selectById(@Param("id")Serializable id);


    @Select("select * from zsl_store_commodity where user_id=#{userId}")
    List<ZslStoreCommodity> selectListByUserId(@Param("userId")Long userId);
}
